<?php

/*
|--------------------------------------------------------------------------
| Application Routes
| 应用程序路由
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| 在这里你可以为应用程序注册所有的路由。
| It's a breeze. Simply tell Laravel the URIs it should respond to
| 这非常的容易。简单的告诉 Laravel 这些 URI 应该响应，
| and give it the Closure to execute when that URI is requested.
| 并且给它一个闭包，当那个URI发起请求后执行它。
|
*/

//扣取路由控制器名称

Route::get('/', function()
{
	if(!Session::get('nativeid')){
		return View::make('login');
	}
	return View::make('index');
});

/*API*/
Route::group(array('prefix' => 'v1'), function(){
    /*权限*/
    Route::resource('admin',                        'AdminController');

	/*教师（用户）*/
	Route::resource('teacher',              		'TeacherController');

	/*教师与班级关联*/
	Route::resource('teacher.classes',              'TeacherClassesController');
	
	/*学生*/
	Route::resource('student',              		'StudentController');

	/*课程*/
	Route::resource('subject',              		'SubjectController');

	/*班级*/
	Route::resource('classes',              		'ClassesController');

	/*课程分数*/
	Route::resource('studentsubjectscore',          'StudentSubjectScoreController');

	/*考试*/
	Route::resource('test',          'TestController');

	/*作业*/
	Route::resource('homework',       'HomeworkController');

});

/*权限*/
Route::get('user/check/session',                    'UserController@check_session');
Route::post('user/login',                           'UserController@login');
Route::put('user/{id}/setpwd',                      'UserController@setpwd');
Route::get('user/logout',                           'UserController@logout');
Route::get('user/power',                            'UserController@power');



/**/